package jtk.project4.fleet.field;

import javax.swing.SortOrder;

import jtk.project4.fleet.domain.MeterLog;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.control.GroupControl;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;


public class UpdateMeterLogField extends GroupControl {
	
	private TableField<MeterLog> updateMeterLogTable;
	public UpdateMeterLogField (String bindID){
		//setTitle("header.UpdateMeterLog");
		setBindID(bindID);
		createField();
		createLayout();
	}
	
	private void createField(){
		
		//setup table
		updateMeterLogTable = new TableField<MeterLog> ("UpdateMeterLog","MeterLog");
		//updateMeterLogTable.setTitle ("UpdateMeterLogTable.header.table");
		updateMeterLogTable.setAutoResizeMode(AutoResizeMode.OFF);
		updateMeterLogTable.getSelectionValues();
		
		//add columns
//		updateMeterLogTable.addColumn("label.identification:","identification:");
//		updateMeterLogTable.addColumn("label.location","location");
//		updateMeterLogTable.addColumn("label.category","category");
		updateMeterLogTable.addColumn("label.meter1","units");
		updateMeterLogTable.addColumn("label.meter2","units2");
		updateMeterLogTable.addColumn("label.date","logDate");
		
		//Sort
		updateMeterLogTable.sort("identification:", SortOrder.ASCENDING);
		
	}
	
	private void createLayout(){
		setLayout (new FormLayout())
		.addField(updateMeterLogTable);
	}
}